package lanQiaoBei.基础算法.前缀和.差分;

import java.io.*;

/*
 * “一维差分”———输入一个长度为n的整数数列
 * 接下来输入m个操作每个操作包含三个整数表示在在数列l到r每位加上一个c
 * 请你输出进行完所有操作后的序列
 *
 * 第一行包含两个整数1<n，m<=100000
 * 第二行包含n长度的数列
 * 接下来m行包含m行l,r,c
 * */
public class P1 {
    static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    static int N = 100010;
    static int n;
    static int m;
    static int[] a = new int[N];
    static int[] b = new int[N];

    public static void main(String[] args) throws Exception {
        scan();
        while (m-- > 0) {
            String[] ss = br.readLine().split(" ");
            int l = Integer.parseInt(ss[0]), r = Integer.parseInt(ss[1]), c = Integer.parseInt(ss[2]);
            insert(l, r, c);
        }
        for(int i=1;i<=n;i++){
            b[i]=b[i-1]+b[i];
            System.out.print(b[i]+" ");
        }
    }
    public static void scan() throws Exception {
        String[] ss = br.readLine().split(" ");
        n = Integer.parseInt(ss[0]);
        m = Integer.parseInt(ss[1]);
        ss = br.readLine().split(" ");
        for (int i = 1; i <= n; i++) {
            a[i] = Integer.parseInt(ss[i - 1]);
            insert(i,i,a[i]);//构建差分数组
        }
    }
    static void insert(int l,int r,int c){
           b[l]+=c;
           b[r+1]-=c;
    }

}
